import http from '@/utils/http'

const baseURL  = '/index'

/**
 * 登录
 */
export function loginApi(data) {
  return http.post(baseURL + '/login', data, { custom: { loading: true } });
}

/**
 * 获取用户信息
 */
export function fetchUserInfoApi() {
  return http.get(baseURL + '/userInfo', {}, { custom: { loading: false } });
}

/**
 * 获取用户默认收货地址
 */
export function fetchDefaultAddressApi(id) {
  return http.get(baseURL + '/fetchDefaultAddress', {id}, { custom: { loading: true } });
}

/**
 * 更新用户信息
 */

export function updateUserInfoApi(data) {
  return http.post(baseURL + '/updateUserInfo', data, { custom: { loading: true } });
}